@echo off
@REM Make main package

@REM Delete current WSP file

if EXIST ..\Package\ECTSSolution.wsp del ..\Package\ECTSSolution.wsp

@REM Copy neutral resources to the en-US resource file

if EXIST ECTSSolution.en-US.resx del ECTSSolution.en-US.resx
copy ECTSSolution.resx ECTSSolution.en-US.resx

@ Build WSP file

makecab.exe /f Solution.ddf

@REM Copy over ECTSBase package components

if EXIST ..\Package\UndeploySolution.cmd del ..\Package\UndeploySolution.cmd
if EXIST ..\Package\ECTSBaseManifest.xml del ..\Package\ECTSBaseManifest.xml
if EXIST ..\Package\ECTSBaseSolution.ddf del ..\Package\ECTSBaseSolution.ddf
if EXIST ..\Package\EAT.Common.dll del ..\Package\EAT.Common.dll
if EXIST ..\Package\ECTSFeatureTemplate.xml del ..\Package\ECTSFeatureTemplate.xml
if EXIST ..\Package\ECTSBase.wsp del ..\Package\ECTSBase.wsp
if EXIST ..\Package\ECTSBase.resx del ..\Package\ECTSBase.resx
if EXIST ..\Package\ECTSBase.en-US.resx del ..\Package\ECTSBase.en-US.resx
if EXIST ..\Package\setup.rpt del ..\Package\setup.rpt
if EXIST ..\Package\setup.inf del ..\Package\setup.inf

copy ..\PackageSolution\UndeploySolution.cmd ..\Package\UndeploySolution.cmd
copy ECTSBaseManifest.xml ..\Package\ECTSBaseManifest.xml
copy ECTSBaseSolution.ddf ..\Package\ECTSBaseSolution.ddf
copy ECTSBase.resx ..\Package\ECTSBase.resx
copy ECTSBase.resx ..\Package\ECTSBase.en-US.resx
copy ..\binaries\EAT.Common.dll ..\Package\EAT.Common.dll
copy ..\Common\Common\FEATURES\Common\Feature.xml ..\Package\ECTSFeatureTemplate.xml

if NOT EXIST "%ProgramFiles%\wix\light.exe" goto :NOWIX

"%ProgramFiles%\wix\candle.exe" -out ..\Package\ECTS.wixobj ECTS.wxs
"%ProgramFiles%\wix\light.exe" -out ..\Package\ECTS.msi ..\Package\ECTS.wixobj

@REM Clean up intermediate file
if EXIST ..\Package\ECTS.wixobj del ..\Package\ECTS.wixobj

goto :END

:NOWIX

@ECHO WIX not installed!  Will not make the MSI.
@ECHO.
@ECHO To build the MSI, please install WiX 2.0 under "%ProgramFiles%\wix".
@ECHO.

:END
